cmake_minimum_required(VERSION 3.24)

project(yolov8 LANGUAGES CXX CUDA)

add_definitions(-DAPI_EXPORTS)
set(CMAKE_CXX_STANDARD 17)

# include and link dirs of cuda and tensorrt, you need adapt them if yours are different
# ============= cuda ============
include_directories("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/include/")


include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/plugin)

add_library(myplugins SHARED ${PROJECT_SOURCE_DIR}/plugin/yololayer.cu)
target_link_libraries(myplugins nvinfer cudart)

set(OpenCV_DIR D:/Tool/opencv/build/x64/vc15/lib)
set(OpenCV_INCLUDE_DIRS D:/Tool/opencv/build/include)
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})


file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.cu)
add_executable(yolov8 ${PROJECT_SOURCE_DIR}/main.cpp ${SRCS})

target_link_libraries(yolov8 nvinfer)
target_link_libraries(yolov8 cudart)
target_link_libraries(yolov8 myplugins)
target_link_libraries(yolov8 ${OpenCV_LIBS})

